<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class CreateChannelRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'account' => 'bail|required|unique:game_server.channels,account',
            'distributer_id' => 'bail|required|unique:game_server.channels',
            'phone' => 'nullable|numeric',
            'email' => 'nullable|email',
        ];
    }

    public function messages()
    {
        return [
            'account.required' => '账户名必填',
            'account.unique' => '账户名已存在',
            'distributer_id.required' => '渠道编号必填',
            'distributer_id.unique' => '渠道编号已存在',
            'phone' => '手机号码格式不正确',
            'email' => '邮箱格式不正确',
        ];
    }
}
